#    Copyright (C) 2007, Maxime Biais <maxime@biais.org>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#


### HEADER ###################################################################
header = """<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd ">
<svg width="%(w)s" height="%(h)s" xmlns="http://www.w3.org/2000/svg">
"""

### FOOTER ###################################################################
footer = """</svg>"""

### GRID #####################################################################
grid = """<defs>
  <pattern width="20" patternUnits="userSpaceOnUse" id="axeX" height="%(h)s">
    <path stroke="black" stroke-width="0.25" d="M 0 0, L 0 10" fill="none"/>
    <path stroke="lightgray" stroke-width="0.25" d="M 10 10, V 5" fill="none"/>
  </pattern>
  <pattern width="10" patternUnits="userSpaceOnUse" id="axeY" height="20">
    <path stroke="black" stroke-width="0.25" d="M 0 0, L 10 0" fill="none"/>
    <path stroke="lightgray" stroke-width="0.25" d="M 5 10, L 10 10" fill="none"/>
  </pattern>
  <pattern width="10" patternUnits="userSpaceOnUse" id="grid" height="10">
    <path stroke="lightgray" stroke-width="0.25" d="M 0 0, L 10 0, L 10 10,L 0 10, L 0 0" fill="none"/>
  </pattern>
</defs>
<g transform="scale(1,-1) translate(0, -%(h)s)">
  <rect height="%(h)s" width="%(w)s" stroke="lightgray" y="0" x="0" stroke-width="0.25" fill="url(#grid)"/>
  <line stroke-width="1" y2="0" x2="%(w)s" stroke="black" y1="0" x1="0"/>
  <line stroke-width="1" y2="%(h)s" x2="0" stroke="black" y1="0" x1="0"/>
</g>
"""

### LINE #####################################################################
line = """<line stroke-width="%(w)s" x1="%(x1)s" y1="%(y1)s" x2="%(x2)s" y2="%(y2)s" stroke="%(color)s"/>"""

### POINTS ###################################################################
points_group = """<g transform="scale(1,-1) translate(0, -%(h)s)">
    %(points)s
</g>
"""

### RECTPOINT ################################################################
point_rect = """<rect height="%(hp)s" width="%(wp)s" x="%(x)s" y="%(y)s" fill="%(color)s"/>"""
